package info.techgeek.labs.hashset;


import java.util.HashSet;

public class WrappedString {
	
	private String s;

	public WrappedString(String s) {
		this.s = s;
	}

	public static void main(String[] args) {
		
HashSet<Object> hs = new HashSet<Object>();
WrappedString ws1 = new WrappedString("aardvark");
WrappedString ws2 = new WrappedString("aardvark");

	String s1 = new String("aardvark");
	String s2 = new String("aardvark");
	
		 hs.add(ws1); hs.add(ws2); hs.add(s1); hs.add(s2);
	
		 
		 
		 System.out.println("ws1"+ws1);
		 System.out.println("ws2"+ws2);
		 System.out.println("s1"+s1);
		 System.out.println("s2"+s2);
		 
		 System.out.println(hs.size());
		 
		 System.out.println(hs);
 }

	public int hashCode(){
		System.out.println("inside ");
		return  1;
	}
	
	public boolean equals( Object o){
		if(o instanceof WrappedString  && ((WrappedString)o).s.equals(this.s) ){
			return true;
		}
		return false;
	}

	
}
